package com.ruoyi.resturant.service.impl;

import com.ruoyi.resturant.domain.ResBanner;
import com.ruoyi.resturant.mapper.ResBannerMapper;
import com.ruoyi.resturant.service.IResBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * 轮播图Service业务层处理
 *
 * @author Daniel
 * @date 2023-09-27
 */
@Service
public class ResBannerServiceImpl implements IResBannerService
{

    // 初始化数据
    private final static Map<Integer, ResBanner> resBanners = new LinkedHashMap<Integer, ResBanner>();
    {
    //空
    }

    @Autowired
    private ResBannerMapper resBannerMapper;

    @Override
    public List<ResBanner> getAllResBanners(){        // 23201013517-李晓雪
        return resBannerMapper.queryAll();
    }

    /**
     * 查询轮播图
     *
     * @param id 轮播图主键
     * @return 轮播图
     */
    @Override
    public ResBanner selectResBannerById(Long id)      // 23201013517-李晓雪
    {
        return resBannerMapper.selectResBannerById(id);
    }

    /**
     * 查询轮播图列表
     *
     * @param bannerName 轮播图名称
     * @return 轮播图
     */
    @Override
    public List<ResBanner> selectBannerByParam(String bannerName)    // 23201013517-李晓雪
    {
        return resBannerMapper.selectBannerByParam(bannerName);
    }

    /**
     * 新增轮播图
     *
     * @param resBanner 轮播图
     * @return 结果
     */
    @Override
    public int insertResBanner(ResBanner resBanner)      // 23201013517-李晓雪
    {
        return resBannerMapper.insertResBanner(resBanner);
    }

    /**
     * 修改轮播图
     *
     * @param resBanner 轮播图
     * @return 结果
     */
    @Override
    public int updateResBanner(ResBanner resBanner)      // 23201013517-李晓雪
    {
        return resBannerMapper.updateResBanner(resBanner);
    }

    /**
     * 删除轮播图信息
     *
     * @param id 轮播图主键
     * @return 结果
     */
    @Override
    public int deleteResBannerById(Long id)            // 23201013517-李晓雪
    {
        return resBannerMapper.deleteResBannerById(id);
    }
}